package com.linwen.javase.desgin_pattern.action.state;

/**
 * @ClassName Context
 * @Description
 * @Author lin
 * @Date 2022/6/29 下午11:44
 * @Version V1.0
 */
//环境类
class Context {
    private State state;
    //定义环境类的初始状态
    public Context() {
        this.state = new ConcreteStateA();
    }
    //设置新状态
    public void setState(State state) {
        this.state = state;
    }
    //读取状态
    public State getState() {
        return (state);
    }
    //对请求做处理
    public void Handle() {
        state.Handle(this);
    }
}